<template>
  <div class="school">
    <h2>学校名称:{{ name }}</h2>
    <h2>学校地址:{{ address }}</h2>
    <button @click="sendSchoolName">点击把学校名给app组件</button>
  </div>
</template>

<script>
export default {
  name: "School",
  data() {
    return {
      name: "三峡学院",
      address: "重庆",
    };
  },
  methods: {
    sendSchoolName() {
      this.getSchoolName(this.name);
    },
  },
  props: ["getSchoolName"],
};
</script>
<style scoped>
.school {
  padding: 5px;
  background-color: skyblue;
}
</style>

